<?php
/**
 * 用户登录记录模型
 * @date    2020-01-01
 * @author  kiro
 * @email   294843009@qq.com
 * @version 1.0
 */
/*	/*
	 * All rights Reserved, Designed By www.youyacao.com <br>
	 * @Description:用户登录记录模型 <br>
	 * @version 蜻蜓C影视追剧系统  <br>
	 * @author:成都市一颗优雅草科技有限公司  <br>
	 * 注意：使用我司开源源代码请遵循license文件的协议仅供个人非盈利使用，禁止用于其他的商业用途
	 * 需要商业用途或者定制开发等可访问songshu.youyacao.com  联系QQ:2853810243 422108995 23625059584
	 * 正版系统查询系统 zhengbancha.youyacao.com
	 */
namespace App\Models;

class UserLoginLog extends BaseModel
{
    protected $table = 'user_login_log';

    protected $fillable = [
        'username',
        'login_type',
        'ip',
        'requests',
        'remark',
        'status'
    ];

    public static function addLog($username, $login_type = 0, $remark = '', $status = 0)
    {
        $request = request()->all();
        unset($request['password']);
        return self::create([
            'username'  => $username,
            'login_type'=> $login_type,
            'ip'        => request()->ip(),
            'requests'  => json_encode($request),
            'remark'    => $remark,
            'status'    => $status
        ]);
    }
}
